local skel = fk.CreateSkill {
  name = "emo__jieyuan",
  tags = {Skill.Limited},
}

skel:addEffect("active", {
  anim_type = "support",
  prompt = "#emo__jieyuan",
  can_use = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryGame) == 0
  end,
  card_num = 0,
  card_filter = Util.FalseFunc,
  target_num = 2,
  target_filter = function (self, player, to_select, selected, selected_cards)
    if #selected == 0 then
      return true
    elseif #selected == 1 then
      local to1 = selected[1]
      local to2 = to_select
      return to1.kingdom == "moe" or to2.kingdom == "moe" or to1.gender ~= to2.gender
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local to1 = effect.tos[1]
    local to2 = effect.tos[2]
    local x = to1.maxHp - to2.maxHp
    if x > 0 then
      room:changeMaxHp(to2, x)
    elseif x < 0 then
      room:changeMaxHp(to1, -x)
    end
    local y = to1.hp - to2.hp
    if y > 0 and not to2.dead then
      room:recover({ who = to2, num = y, recoverBy = player, skillName = skel.name  })
    elseif y < 0 and not to1.dead then
      room:recover({ who = to1, num = -y, recoverBy = player, skillName = skel.name  })
    end
    room:handleAddLoseSkills(to1, "emo__yuanding")
    room:handleAddLoseSkills(to2, "emo__yuanding")
  end,
})

Fk:loadTranslationTable{
  ["emo__jieyuan"] = "结缘",
  [":emo__jieyuan"] = "限定技，出牌阶段，你可以指定两名异性角色（萌势力角色不限性别），这两名角色将体力上限、体力值均调整为两角色中的较大值，然后获得〖缘定〗。",
  ["#emo__jieyuan"] = "令两名角色结缘！",
}


return skel
